﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace WebServer
{
    /// <summary>
    /// This exception is thrown when you try to execute a command 
    /// which is not permitted with your current permission set
    /// </summary>
    [Serializable]
    public class ElevatedPermissionRequiredException : Exception
    {
        private const String ELEVATED_PERMISSION_REQUIRED = "Elevated Permission Required";

        /// <summary>
        /// Default Constructor, sets the message as "Elevated Permission Required"
        /// </summary>
        public ElevatedPermissionRequiredException() : base(ELEVATED_PERMISSION_REQUIRED) { }
        /// <summary>
        /// Includes a message in the exception
        /// </summary>
        /// <param name="message">The message to be included</param>
        public ElevatedPermissionRequiredException(String message) : base(message) { }
        /// <summary>
        /// Includes a root exception and the message "Elevated Permission Required"
        /// </summary>
        /// <param name="innerException">The root exception to be included</param>
        public ElevatedPermissionRequiredException(Exception innerException) : base(ELEVATED_PERMISSION_REQUIRED, innerException) { }
        /// <summary>
        /// Includes a root exception and specific message
        /// </summary>
        /// <param name="message">The message to be included</param>
        /// <param name="innerException">The root exception to be included</param>
        public ElevatedPermissionRequiredException(String message, Exception innerException) : base(message, innerException) { }
        /// <summary>
        /// Creates an ElevatedPermissionRequiredException with the specified serialization info and context
        /// </summary>
        /// <param name="info">The serialization info to associate with this exception</param>
        /// <param name="context">The streaming context to associated with this exception</param>
        protected ElevatedPermissionRequiredException(SerializationInfo info, StreamingContext context) : base(info, context) { }
    }
}
